function settime(that, name) {
  that.setData({
    multiArray: [['今天', '明天', '后天'], [name, '1点', '2点', '3点', '4点', '5点', '6点', '7点', '8点', '9点', '10点', '11点', '12点', '13点', '14点', '15点', '16点', '17点', '18点', '19点', '20点', '21点', '22点', '23点'], []],
    multiIndex: [0, 0, 0]
  })
}
function bindMultiPickerColumnChange(e, that, name) {
  const data = {
    multiArray: that.data.multiArray,
    multiIndex: that.data.multiIndex
  }
  data.multiIndex[e.detail.column] = e.detail.value
  switch (e.detail.column) {
    case 0:
      switch (data.multiIndex[0]) {
        case 0:
          data.multiArray[1] = [name, '1点', '2点', '3点', '4点', '5点', '6点', '7点', '8点', '9点', '10点', '11点', '12点', '13点', '14点', '15点', '16点', '17点', '18点', '19点', '20点', '21点', '22点', '23点']
          data.multiArray[2] = []
          break
        default:
          data.multiArray[1] = ['1点', '2点', '3点', '4点', '5点', '6点', '7点', '8点', '9点', '10点', '11点', '12点', '13点', '14点', '15点', '16点', '17点', '18点', '19点', '20点', '21点', '22点', '23点']
          data.multiArray[2] = ['0分', '5分', '10分', '15分', '20分', '25分', '30分', '35分', '40分', '45分', '50分', '55分']
          break
      }
      data.multiIndex[1] = 0
      data.multiIndex[2] = 0
      break
    case 1:
      switch (data.multiIndex[0]) {
        case 0:
          switch (data.multiIndex[1]) {
            case 0:
              data.multiArray[2] = []
              break
            default:
              data.multiArray[2] = ['0分', '5分', '10分', '15分', '20分', '25分', '30分', '35分', '40分', '45分', '50分', '55分']
              break
          }
          break
        case 1:
          switch (data.multiIndex[1]) {
            case 0:
              data.multiArray[2] = ['0分', '5分', '10分', '15分', '20分', '25分', '30分', '35分', '40分', '45分', '50分', '55分']
              break
            default:
              data.multiArray[2] = ['0分', '5分', '10分', '15分', '20分', '25分', '30分', '35分', '40分', '45分', '50分', '55分']
              break
          }
          break
      }
      data.multiIndex[2] = 0
      break
  }
  that.setData(data)
}

function bindMultiPickerChange(e, that) {
  console.log('picker发送选择改变，携带值为', e.detail.value)
  var datearray = e.detail.value;
  var myDate = new Date();
  var y=myDate.getFullYear();    //获取完整的年份(4位,1970-????)
  var m=myDate.getMonth();       //获取当前月份(0-11,0代表1月)
  var d=myDate.getDate();        //获取当前日(1-31)
  var todaystrng=Number(new Date(y + '-' + m + '-' + d + ' ' + '0:0:0')/1000);//当天时间戳
  if (datearray[0]==0){

    var selecttime = todaystrng + datearray[0] * 24 * 3600 + (datearray[1]) * 3600 + (datearray[2]) * 5 * 60;
  }else{

    var selecttime = todaystrng + datearray[0] * 24 * 3600 + (datearray[1]+1) * 3600 + (datearray[2]) * 5 * 60;
  }


  that.setData({
    selecttimen: selecttime
  })
}

function setselecttime(selecttime,that){
  var nowtime = Number(new Date());
  if (typeof (selecttime)=='undefined'){
    that.setData({ selecttimen: parseInt(nowtime / 1000)})
   }else{
    that.setData({ selecttimen: selecttime})
   }
}

module.exports={
  bindMultiPickerColumnChange: bindMultiPickerColumnChange,
  settime: settime,
  bindMultiPickerChange: bindMultiPickerChange,
  setselecttime: setselecttime
}